const fs = require("fs");


console.log(__filename);
console.log(__dirname);

// 这个路径是相对于cmd终端的路径地址

// 使用绝对路径
// D:\Users\Desktop\2022IT培训Web全栈面授就业班18班\代码\day05\代码\demo\a.txt
let filepath = __dirname + "\\demo\\a.txt";
console.log(filepath);

let res =  fs.readFileSync(filepath,"utf-8");
console.log(res);